import platform
from fastapi import APIRouter

from src.backend.utils.envLoader import appConfig

from src.backend.routes.auth import router as authRouter

# 创建主路由
router = APIRouter(
    prefix="/api",
    tags=["API"],
    responses={404: {"description": "Not found"}},
)

# 主路由
@router.get("/")
async def index():
    """
    # 根接口
    返回服务状态、环境变量和操作系统信息。
    
    - **status**: 服务状态
    - **environment**: 主要环境变量
    - **os**: 操作系统相关信息
    """
    return {
        "status": "ok",
        "environment": {
            "VITE_HMR": appConfig.VITE_HMR,
            "FASTAPI_RELOAD": appConfig.FASTAPI_RELOAD,
            "FASTAPI_DOC": appConfig.FASTAPI_DOC,
        },
        "os": {
            "platform": platform.platform(),
            "version": platform.version(),
            "architecture": platform.architecture(),
            "machine": platform.machine(),
            "processor": platform.processor(),
            "python": platform.python_version(),
        }
    }

router.include_router(authRouter)

# 导出主路由
__all__ = ["router"] 